﻿using System.Windows;

namespace BookvarWpf.Controls
{
    /// <summary>
    /// Interaction logic for ProgressAnimation.xaml
    /// </summary>
    public partial class ProgressAnimation
    {
        #region Events

        #region AnimationStart

        public static readonly RoutedEvent AnimationStartEvent =
            EventManager.RegisterRoutedEvent( "AnimationStart", RoutingStrategy.Bubble, typeof ( RoutedEventHandler ),
                                              typeof ( ProgressAnimation ) );

        public event RoutedEventHandler AnimationStart
        {
            add { AddHandler( AnimationStartEvent, value ); }
            remove { RemoveHandler( AnimationStartEvent, value ); }
        }

        private void RaiseAnimationStartEvent()
        {
            RoutedEventArgs args = new RoutedEventArgs( AnimationStartEvent );
            RaiseEvent( args );
        }

        #endregion


        #region AnimationStop

        public static readonly RoutedEvent AnimationStopEvent =
            EventManager.RegisterRoutedEvent( "AnimationStop", RoutingStrategy.Bubble, typeof ( RoutedEventHandler ),
                                              typeof ( ProgressAnimation ) );

        public event RoutedEventHandler AnimationStop
        {
            add { AddHandler( AnimationStopEvent, value ); }
            remove { RemoveHandler( AnimationStopEvent, value ); }
        }

        private void RaiseAnimationStopEvent()
        {
            RoutedEventArgs args = new RoutedEventArgs( AnimationStopEvent );
            RaiseEvent( args );
        }

        #endregion


        #endregion

        public ProgressAnimation()
        {
            InitializeComponent();
        }


        public void Start()
        {
            RaiseAnimationStartEvent();
        }

        public void Stop()
        {
            RaiseAnimationStopEvent();
        }
    }
}